package com.chixing.service.impl;

import com.chixing.mapper.NotesReviewMapper;
import com.chixing.pojo.NotesReview;
import com.chixing.service.NotesReviewService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class NotesReviewServiceImpl implements NotesReviewService {
    @Autowired
    private NotesReviewMapper notesReviewMapper;
    @Override
    public ServerResponse insert(Integer notesId,Integer custId,String text) {
        NotesReview notesReview = new NotesReview();
        notesReview.setTravelNotesId(notesId);
        notesReview.setCustId(custId);
        notesReview.setNotesReviewContent(text);
        Date date = new Date();
        notesReview.setNotesReviewTime(date);
        int insert = notesReviewMapper.insert(notesReview);
        if(insert>0){
            return ServerResponse.getSuccess(insert);
        }else {
            return ServerResponse.getFail(null);
        }

    }
}
